// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 获取租户列表 GET /api/tenants */
export async function matchingList(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.MatchingList>(API_URL + '/api/matching/list', {
    method: 'POST',
    data: {
      ...params,
      ...(options || {}),
    },
  });
}

/** 更新规则 PUT /api/rule */
export async function updateMatching(options?: { [key: string]: any }) {
  return request<API.MatchingItem>(API_URL + '/api/matching', {
    method: 'PUT',
    data: {
      id: options?.selectUpdateInfo?.id,
      matching: options?.matching,
    },
  });
}

/** 更新规则 PUT /api/rule */
export async function updateOrder(activeId: any, overId: any) {
  return request<API.MatchingItem>(API_URL + '/api/matching/updateOrder', {
    method: 'PUT',
    headers: { 'Content-Type': 'application/json' },
    data: JSON.stringify({ activeId, overId }),
  });
}
